<?php

/**
 * Require PHPUnit_Framework_TestCase
 */
require_once 'PHPUnit/Framework/TestCase.php';

/**
 * Require PDODB
 */
require_once 'PDODB.php';

/**
 * The base test case class for all PDODB test cases. This test case must be
 * used in conjunction with the custom TestSuite class in order to use the
 * correct database connection parameters stored in TestSuite::$sharedFixture.
 *
 * @package     PDODB
 * @category    Database
 * @author      Michael J. I. Jackson <mjijackson@gmail.com>
 */
class PDODB_TestCase extends PHPUnit_Framework_TestCase
{

    /**
     * Stores the instance of this test case's database connection.
     *
     * @var     PDODB_Connection
     * @access  protected
     */
    protected $db;

    /**
     * Sets up the database connection to use for this test case.
     *
     * @return  void
     * @access  protected
     */
    protected function setUp()
    {
        try {
            extract($this->sharedFixture);
            $this->db = PDODB::factory($dsn, $user, $pass);
        } catch (Exception $e) {
            $this->fail($e->getMessage());
        }
    }

    /**
     * Releases the database connection resource for this test case.
     *
     * @return  void
     * @access  protected
     */
    protected function tearDown()
    {
        unset($this->db);
    }

}

?>
